<template>
    <div>
        <!--使用A模块的数据-->
        <p>{{$store.state.moduleA.username}}</p>
        <p>{{$store.getters.newName}}</p>
        <p>{{$store.state.moduleB.username}}</p>
        <p>{{$store.getters['moduleB/newName1']}}</p>
        <button type="" @click="mutationsFn">mutationsFn</button>
        <button type="" @click="actionFn">actionFn</button>

       </div>
</template>
<script>
import {useStore} from 'vuex'
    export default{
        name:'App',
        setup(){

            const store=useStore()
            // 直接改变
            const mutationsFn=()=>{
                store.commit('moduleB/updateName')
            }
            // 三秒后改变
             const actionFn=()=>{
                 store.dispatch('moduleB/updateName')

            }
            return {mutationsFn,actionFn}
        }
    }
</script>